#pragma once
#include "afn05types.h"
#include <map>

#define Afn05fx_object(AP,x)\
	AP##Afn05f##x& F##x(uint16_t)

#define AFN05_PARSER_DEFINITION(AP) \
class AP##Afn05Parser\
{\
public:\
	typedef AP##Afn05Types Union;\
	typedef map<uint8_t,map<uint16_t,Union>> UnionMap;\
	typedef int(AP##Afn05Parser::*Callback)(uint8_t*);\
	UnionMap umap;\
protected:\
	Callback call[256];\
public:\
	AP##Afn05Parser(void);\
public:\
	void clear(void);\
	bool append(Buffer&);\
	Afn05fx_object(AP,31);\
public:\
	int parse(uint8_t *data, int len);\
	int parseF31(uint8_t*);\
};

#pragma pack(1)
AFN05_PARSER_DEFINITION(Active)
AFN05_PARSER_DEFINITION(Pasive)
#pragma pack(0)

class Afn05Parser
{
	ActiveAfn05Parser active;
	PasiveAfn05Parser pasive;
public:
	Afn05Parser(void);
};
